﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace MVCExtension.ModelBinders
{
    public class StringTrimModelBinder : DefaultModelBinder
    {
        public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var value = base.BindModel(controllerContext, bindingContext);
            if (value is string)
            {
               // MVCExtension.FrameWork.Logger.Debug((value + ":" + (value as string).Trim()));
                return (value as string).Trim();
            }

            return value;
        }

    }
}
